# 1.定义动物类，有年龄和姓名属性，具有吃和睡的行为
# class Animal:
#     def __init__(self, name, age):
#         self.name = name
#         self.age = age
#
#     def eat(self):
#         print(f'{self.name}吃东西')
#
#     def sleep(self):
#         print(f'{self.name}睡觉')
# # 2.定义猫类，具有动物的属性和方法，且具有抓老鼠的行为
# class Cat(Animal):
#     def catch(self):
#         print(f'{self.name}会抓老鼠')
#
#
# if __name__ == '__main__':
#     a = Animal('佩奇', 2)
#     a.eat()
#     a.sleep()
#     b = Cat('喵喵', 3)
#     b.eat()
#     b.sleep()
#     b.catch()

import random


class Game:
    top_score = 0

    def __init__(self, name):
        self.play_name = name

    @staticmethod
    def show_help():
        print('这是游戏的帮助信息')

    @classmethod
    def show_top_score(cls):
        print(f'历史最高分为：{cls.top_score}')

    def start_game(self):
        print(f'玩家{self.play_name}开始游戏')
        score = random.randint(10, 100)
        print(f'玩家{self.play_name}本次游戏得分为{score}')
        if score > Game.top_score:
            Game.top_score = score


if __name__ == '__main__':
    Game.show_help()
    Game.show_top_score()
    player = Game('小王')
    player.start_game()
    Game.show_top_score()
    player.start_game()
    Game.show_top_score()
